<template>
    <div id="abilities" :style="{background: `url(${bgImg}) no-repeat`}">
        <div class="abilities-container">
            <div class="title">{{title}}</div>
            <div class="main">
                <div class="list">
                    <div @mouseenter="enter(index)" class="item" :style="{background: index === activeIndex ? bgColor : ''}" :key="index" v-for="(item, index) in list">
                        <img :src="item.icon" alt="ability">
                        <span>{{item.label}}</span>
                    </div>
                </div>
                <div class="detail">
                    <div class="top">
                        <div class="title">{{list[activeIndex].subtitle}}</div>
                        <div class="desc">{{list[activeIndex].desc}}</div>
                    </div>
                    <div class="shows">
                        <img :src="img" alt="" :key="id" v-for="(img, id) in list[activeIndex].imgs">
                    </div>
                </div>
            </div>
            <div class="instant">
                <button>立即体验</button>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    props: {
        title: {
            type: String,
            default: ''
        },
        desc: {
            type: String,
            default: ''
        },
        list: {
            type: Array,
            default: []
        },
        bgImg: {
            type: String,
            default: ''
        }
    },
    data() {
        return {
            activeIndex: 0,
            bgColor: 'rgba(69, 116, 247, 0.86)',
            defBgColor: 'rgba(0, 0, 0, 0.5)'
        }
    },
    methods: {
        enter(index) {
            console.log('in');
            this.activeIndex = index;
            this.bgColor = 'rgba(69, 116, 247, 0.86)';
        }
    }
}
</script>

<style lang="scss" scoped>
#abilities {
    background: #eee;
    background-size: cover!important;
    .abilities-container {
        width: 1250px;
        padding: 80px 0;
        margin: 0 auto;
        box-sizing: border-box;
        text-align: center;
        .title {
            width: 100%;
            color: #FFFFFF;
            font-size: 36px;
            font-weight: 600;
            margin-bottom: 100px;
        }
        .main {
            display: flex;
            .list {
                background: rgba(0, 0, 0, 0.5);
                border-radius: 4px;
                height: fit-content;
                padding-bottom: 17px;
                .item {
                    width: 140px;
                    height: 48px;
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    transition: all .2s linear;
                    border-radius: 4px;
                    img {
                        width: 26px;
                        height: 26px;
                        margin-right: 8px;
                    }
                    span {
                        font-family: PingFangSC-Regular;
                        font-size: 20px;
                        color: #FFFFFF;
                    }
                }
            }
            .detail {
                margin-left: 40px;
                padding-left: 40px;
                box-sizing: border-box;
                border-left: 2px solid #E0E7FB;
                .top {
                    text-align: left;
                    .title {
                        font-size: 24px;
                        color: #FFFFFF;
                        line-height: 32px;
                        font-weight: 400;
                        margin-bottom: 20px;
                    }
                    .desc {
                        font-size: 16px;
                        font-family: PingFang SC;
                        font-weight: 400;
                        color: #FFFFFF;
                        line-height: 24px;
                        opacity: 0.7;
                    }
                }
                .shows {
                    margin-top: 90px;
                    display: flex;
                    img {
                        width: 300px;
                        height: 170px;
                        margin-left: 38px;
                    }
                }
            }
        }
        .instant {
            margin-top: 84px;
            button {
                margin: 0 auto;
                width: 140px;
                height: 48px;
                box-sizing: border-box;
                border: 2px solid #FFFFFF;
                border-radius: 6px;
                display: flex;
                justify-content: center;
                align-items: center;
                font-size: 20px;
                color: #FFFFFF;
                background: transparent;
            }
        }
    }
}
</style>